package com.example.userclient;

import android.os.Parcel;
import android.os.Parcelable;

public class Position implements Parcelable {
    private Double latitude;
    private Double longitude;
    private String coorType;
    private String address;


    public Position(Double latitude, Double longitude, String coorType,String address) {
        this.latitude = latitude;
        this.longitude = longitude;
        this.coorType = coorType;
        this.address = address;
    }

    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }

    public String getCoorType() {
        return coorType;
    }

    public void setCoorType(String coorType) {
        this.coorType = coorType;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.latitude);
        dest.writeValue(this.longitude);
        dest.writeString(this.coorType);
        dest.writeString(this.address);
    }

    public void readFromParcel(Parcel source) {
        this.latitude = (Double) source.readValue(Double.class.getClassLoader());
        this.longitude = (Double) source.readValue(Double.class.getClassLoader());
        this.coorType = source.readString();
        this.address = source.readString();
    }

    public Position() {
    }

    protected Position(Parcel in) {
        this.latitude = (Double) in.readValue(Double.class.getClassLoader());
        this.longitude = (Double) in.readValue(Double.class.getClassLoader());
        this.coorType = in.readString();
        this.address = in.readString();
    }

    public static final Parcelable.Creator<Position> CREATOR = new Parcelable.Creator<Position>() {
        @Override
        public Position createFromParcel(Parcel source) {
            return new Position(source);
        }

        @Override
        public Position[] newArray(int size) {
            return new Position[size];
        }
    };
}
